<% if @bug
  @dataobjects = @bug.dataobjects
end %>

<% if !@dataobjects.empty? %>
  <% @dataobjects.each do |dataobject| %>
    <div class="gru-filelist">
      <span class="gru-filelist-name"><%= dataobject.name %></span>
      <span class="gru-filelist-date"><%= l(dataobject.created_at, :format => :short) %></span>
      <span class="gru-filelist-links">
        <%=
        if @bug
          link_to (t :delete, :scope => [:helpers, :navigation]), project_bug_dataobject_path(@project.id, @bug.id, dataobject), :confirm => (t :delete_dataobject, :scope => [:helpers, :messages]), :method => :delete
        elsif params[:project_id]
          link_to (t :delete, :scope => [:helpers, :navigation]), project_dataobject_path(@project.id, dataobject), :confirm => (t :delete_dataobject, :scope => [:helpers, :messages]), :method => :delete
       end
      %>
      </span>
      <span class="gru-filelist-links"><%= link_to (t :download, :scope => [:helpers, :navigation, :dataobject]), :controller => 'dataobjects', :action => 'download', :id => dataobject.id %></span>
      <br />
      <p class="gru-filelist-description"><%= dataobject.description%></p>
    </div>
  <% end %>

  <% if !@bug %>
    <span><%= link_to (t :new_file, :scope => [:helpers, :navigation, :dataobject]), new_project_dataobject_path(params[:project_id]) %></span>
  <% end %>

<% else %>

  <% if @bug %>
    <p id="gru-no-files-attached-message" ><%= t :none_bug, :scope => [:helpers, :messages, :dataobject]%></p>
  <% elsif params[:project_id] %>
    <p><%= t :none_project, :scope => [:helpers, :messages, :dataobject]%></p>
    <span><%= link_to (t :add_dataobject, :scope => [:helpers, :submit]), new_project_dataobject_path(params[:project_id]) %></span>
  <% end %>
<% end %>
